package model;

import java.util.ArrayList;
import java.util.GregorianCalendar;

public class DailyIrregular extends Prescription{
	
	private ArrayList<Dose> doses = new ArrayList<Dose>();
	
	public DailyIrregular(GregorianCalendar startDate, GregorianCalendar endDate) {
		super(startDate, endDate);
	}

	/*
	 * Adds a new Dose object to the list using time and count values.
	 */
	public void createDose(String time, double count) {
		doses.add(new Dose(time, count));
	}

	/*
	 * Removes the supplied Dose object from the doses list.
	 */
	public void removeDose(Dose dose){
		doses.remove(dose);
	}
	
	public ArrayList<Dose> getDoses() {
		return doses;
	}
	
	@Override
	public double dayDose() {
		double count = 0; // Dose unit counter
		for (Dose dose : doses) // for each dose in doses
			count += dose.getCount(); // increase count with dose.getCount (wich is units for that dose)
		return count; // return total number of units counted.
	}

	@Override
	public double totalDose() {
		return dayDose() * dayCount(); // Return the number of dose units for all days.
	}
	
}
